package com.yuw.sort;

public class TestDriver02 {

	public static void main(String[] args) {
		test01();
	}

	/**
	 * 字符串的使用
	 */
	private static void test01() {
		// 定义一个String类型的变量
		int i = 1;
		String str0 = "jaldfjldsajflewjlf;lsfj;ds  dlkjflkadsjfwlkjfe;l jslkfj aj;lfjewl ";
		// 使用new进行赋值
		String str1 = new String("jaldfjldsajflewjlf;lsfj;ds  dlkjflkadsjfwlkjfe;l jslkfj aj;lfjewl ");
		// char ch0 = str0.charAt(3000);
		char ch0 = str0.charAt(str0.length() - 2); // 倒数第二个字符
		System.out.println("str0.charAt(3)::" + ch0);

		String strNew1 = str0.concat("80328409328042");
		System.out.println("strNew1::" + strNew1);
		System.out.println("str0::" + str0);

		String strSub = str0.substring(3, 6);
		System.out.println("strSub::" + strSub);

		// contains方法的使用
		boolean isContained = str0.contains("dlkjf");
		System.out.println("isContained：：" + isContained);

		String strReplace = str0.replace("s", "XXXX");
		System.out.println("strReplace::" + strReplace);
		System.out.println("str0::" + str0);

		String[] arrStrs = str0.split(";");
		for (String string : arrStrs) {
			System.out.println(" " + string);
		}

		boolean isOk = str0.startsWith("jaldf ".trim());
		System.out.println("isOk::" + isOk);
		
		boolean isEqual = str0.equals("jaldf");
		System.out.println("isequal：："+isEqual);
		
		System.out.println("str0==str1::"+(str0 == str1));
		System.out.println("str0.equals(str1)::"+(str0.equals(str1)));  /// true
	}
}
